﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;

namespace WpfApp1
{
    class Utils
    {

        private Object hash_hmac256(string signatureString, string secretKey, bool raw_output = false)
        {
            var enc = Encoding.UTF8;

            HMACSHA256 hmac = new HMACSHA256(enc.GetBytes(secretKey));
            hmac.Initialize();

            byte[] buffer = enc.GetBytes(signatureString);
            if (raw_output)
            {
                return hmac.ComputeHash(buffer);
            }
            else
            {
                return BitConverter.ToString(hmac.ComputeHash(buffer)).Replace("-", "").ToLower();
            }
        }

        private void test()
        {
            String res1 = (String)hash_hmac256("signatureString", "secret");

        }
    }
}
